<?php
/**
 * Created by PhpStorm.
 * User: Yieong
 * Date: 14/11/19
 * Time: 下午8:12
 */

class ModCodePoolChannel extends Model {

    protected $table = 'code_pool_channel';

    // 表名
    public function tableName(){
        return $this->table;
    }

    public static function model($className=__CLASS__){
        return parent::model($className);
    }

    public function getDbConnection(){
        return Yii::app()->dbOss;
    }

    public function selectChannel($code_pool_id){
        
        $sql = "SELECT cpc.id,cpc.code_pool_id,cpc.channel_id,c.channel_name FROM {$this->table} as cpc INNER JOIN channel as c on c.id = cpc.channel_id where code_pool_id = {$code_pool_id} ORDER BY cpc.channel_id DESC ";
        $result = $this->getDbConnection()->getAll($sql, $args);
        return $result;
    }
    
    /**
     * 批量添加
     * @param unknown $params
     * @return unknown
     */
    public function multiAdd($params){
    	$result = $this->getDbConnection()->multiInsert($params, $this->table, FALSE);
    	return $result;
    }
    
    

    
} 